import * as types from './mutation-types'
import * as api from '../assets/api'

export const addTodo = ({commit}, testObj) => {
  api.createTodo(testObj, todo => {
    commit(types.TODO_ADD, todo)
  })
}

export const deleteTodo = ({commit}, todo) => {
  commit(types.TODO_DELETE, todo)
}

export const editTodo = ({commit}, payLoad) => {
  commit(types.TODO_EDIT_TEXT, payLoad)
}
export const toggleTodo = ({commit}, todo) => {
  commit(types.TODO_TOGGLE, todo)
}